package com.manor.one.views;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.manor.common.Constants;
import com.manor.one.R;
import com.manor.one.activity.ChatAnchorActivity;

/**
 * Created by cxf on 2018/10/9.
 * 主播直播间逻辑
 */

public class ChatAnchorViewHolder extends AbsChatLiveViewHolder {

    public ChatAnchorViewHolder(Context context, ViewGroup parentView, int chatType) {
        super(context, parentView, chatType);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.view_chat_anchor;
    }

    @Override
    public void init() {
        super.init();
        if (mChatType == Constants.CHAT_TYPE_VOICE) {
            findViewById(R.id.btn_hands).setVisibility(View.VISIBLE);
            //findViewById(R.id.space).setVisibility(View.VISIBLE);
        }
        findViewById(R.id.btn_gift).setOnClickListener(this);
        findViewById(R.id.btn_charge).setOnClickListener(this);
        findViewById(R.id.btn_guard).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (!canClick()) {
            return;
        }
        super.onClick(v);
        int i = v.getId();
         if (i == R.id.btn_gift) {
            ((ChatAnchorActivity) mContext).openGiftWindow();
        } else if (i == R.id.btn_charge) {
            ((ChatAnchorActivity) mContext).openChargeWindow();
        }else if (i == R.id.btn_guard){
            ((ChatAnchorActivity) mContext).openGuardWindow();
        }
    }


}
